<template>
  <div class="home">
    <!-- <my-top></my-top> -->
    <div class="top ignore">
      <div class="left" >
        <animation v-model="start"></animation>
      </div>
      <!-- <div class="left" v-if="start" @click="change"><img src="../img/start.jpeg" alt="change"/></div>
      <div class="left" v-if="!start" @click="change"><img src="../img/close.jpeg" alt="change"></div> -->
      <div class="right">
        <!-- <div class="mylogo"><img src="../img/logo.png" alt=""/></div> -->
        <!-- 贝浩登&nbsp;PERROTIN -->
        <strong>贝浩登&nbsp;PERROTIN</strong>
      </div>
      <div class="word" v-if="$store.state.language == 'zh'" @click="changeLanguage('en')">
        <div>EN</div>
      </div>
      <div class="word" v-else @click="changeLanguage('zh')">
        <div>中文</div>
      </div>
    </div>
    <!-- <div class="content"><button @click="go">&lt;返回</button></div> -->
    <div class="bottom" :class="{hide : start == false}">
      <router-view/>
      <!-- <img src="../img/index.png" alt=""/> -->
    </div>
    <div class="nav" :class="{active : start == false}">
      <ul>
        <li @click="showTo"><router-link to="/">{{ $t('navs.home') }}</router-link></li>
        <li @click="showTo"><router-link to="/show">{{ $t('navs.show') }}</router-link></li>
        <li @click="showTo"><router-link to="/reservation">{{ $t('navs.order') }}</router-link></li>
        <li @click="showTo"><router-link to="/query">{{ $t('navs.myOrder') }}</router-link></li>
        <li @click="showTo"><a href="https://www.perrotin.com/">{{ $t('navs.webview') }}</a></li>
      </ul>
    </div>
  </div>
</template>

<script>
import animation from "@/components/animation.vue";
// import woff from "@/assets/akzidenz-grotesk-black-webfont.woff2";
export default {
  components: {
    animation
    // woff
  },
  data() {
    return {
      open: false,
      start: true,
      EN: false
    };
  },
  methods: {
    changeLanguage(language) {
      this.$i18n.locale = language;
      this.$store.dispatch("setLanguage", language);
    },
    change() {
      this.start = !this.start;
    },
    showTo() {
      this.start = true;
      document.querySelector("body").setAttribute("style", "overflow:auto");
    }
  },
  created() {
    document.querySelector("body").setAttribute("style", "overflow:auto");
  },
  watch: {
    start: function(val) {
      if (val) {
        document.querySelector("body").setAttribute("style", "overflow:auto");
      } else {
        document.querySelector("body").setAttribute("style", "overflow:hidden");
      }
    }
  }
};
</script>
<style lang="scss" scoped>
.ignore {
  border-bottom: 1px solid black;
}
.home {
  width: 100%;
  // min-height: 100vh;
  display: flex;
  flex-flow: column;
  background: #fff;
  // background-color: antiquewhite;
  .top {
    // height: 7vh;
    height: 8vh;
    width: 100%;
    // background-color: aqua;
    display: flex;
    flex-flow: wrap;
    position: fixed;
    top: 0;
    left: 0;
    background-color: white;
    z-index: 2;
    .left {
      height: 100%;
      width: 52px;
      // background-color: green;
      display: flex;
      justify-content: center;
      align-items: center;
      cursor: pointer;
      img {
        width: 22px;
        height: 22px;
      }
    }
    .word {
      height: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      width: 52px;
      cursor: pointer;
      font-size: 12px;
    }
    .right {
      height: 100%;
      flex: 1;
      font-weight: bolder;
      display: flex;
      justify-content: center;
      align-items: center;
      letter-spacing: 0px;
      font-size: 14pt;
      // line-height: 10px;
      .mylogo {
        // width: 116px;
        // height: 23px;
        // width: 95px;
        width: 160px;
        height: 19px;
        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
  .bottom {
    flex: 1;
    width: 100%;
    position: absolute;
    top: calc(8vh + 1px);
    height: calc(92vh - 1px);
    max-height: calc(92vh - 1px);
    opacity: 1;
    transition: opacity 0.3s;
    // img {
    //   width: 100%;
    //   height: auto;
    // }
  }
  .hide {
    height: calc(100vh - 8vh);
    opacity: 0;
  }
  .nav {
    flex: 1;
    position: fixed;
    top: 7vh;
    height: 86vh;
    background: #fff;
    transition: left 0.5s;
    left: -100%;
    // width: 187px;
    width: 260px;
    // opacity: 1;
    ul {
      font-size: 15px;
      font-weight: bolder;
      padding: 20px 0 0 27px;
      li {
        height: 36px;
        line-height: 36px;
        list-style-type: none;

        position: relative;
        // left: -14px;
        // left: -24px;
        // top: -6px;
        // padding: 20px;
        // padding: 20px 20px 0 20px;
        a {
          text-decoration: none;
          color: black;
        }
      }
    }
  }
  .active {
    position: fixed;
    left: 0;
    top: 8vh;
    // opacity: 0;
    // width: calc(100vw - 40px);
    // padding: 0 20px;
    // border-right: 1px solid #ccc;
  }
}
</style>

